rm(list=ls()) # Clearing the global environment
# Setting the working directory
setwd('C:\\Users\\mawal\\OneDrive - Binghamton University\\Desktop\\Desktop_Folders\\Upwork\\Kreps_2')
df = read.csv('df.csv') # Importing the Study 1 Full Analysis File I converted to csv.

df$total = 5

df$gpt_prop_incorrect = df$gpt_incorrect/df$total
df$hum_prop_correct = df$human_correct/df$total

library(dplyr)
test = df %>%
  summarize(gpt_test = mean(gpt_prop_incorrect), hum_test = mean(hum_prop_correct))

correct = as.numeric(c(0.650462962962963, 0.4541667))
labels = c('Human Correct', 'GPT3 Incorrect')

df_new = data.frame(cbind(correct, labels))


df_new$correct = as.numeric(as.character(df_new$correct))
df_new$labels = relevel(df_new$labels, ref = 2)

library(ggplot2)
ggplot(df_new, aes(x = labels, y = correct)) + geom_bar(stat="identity") + 
  ggtitle('Proportion of Correct Responses GPT3 vs.Human') +
  xlab('') + ylab('Proportion Correct') +
  theme_classic() +
  ylim(0,1) + geom_text(x='GPT3 Incorrect', y=.3, label="0.45", color = 'white') +
  geom_text(x='Human Correct', y=.5, label="0.65", color = 'white') 

